package com.ccl.iot.publics;import android.content.Context;
import android.util.SparseArray;

public class Res {
	private static SparseArray<String> gStringBuffer = null;
	
	/*
	 * 	Part of String
	 */
	public static boolean AddString(Context aContext, int ...aIDs){
		if (aIDs != null && aIDs.length > 0){
			for (int i = 0; i < aIDs.length; i++){
				if (GetString(aContext, aIDs[i]) == null){
					return false;
				}
			}
			
			return true;
		}
		
		return false;
	}
	
	public static String GetString(int aID){
		if (gStringBuffer != null){
			return gStringBuffer.get(aID);
		}

		return null;
	}
	
	public static String GetString(Context aContext, int aID){
		String tString = GetString(aID);
		
		if (tString == null && aContext != null){
			tString = aContext.getResources().getText(aID).toString();
			
			if (gStringBuffer == null){
				gStringBuffer = new SparseArray<String>();
			}
			
			gStringBuffer.append(aID, tString);
		}
		
		return tString;
	}
}
